<style type="text/css">
<!--
.STYLE3 {color: #FFFFFF; font-weight: bold; }
.STYLE4 {color: #FF0000}
-->
</style>
      <div class="content bolr">
        <h2 class="h2">比赛列表</h2>
        <div class="middle"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
	  <tr>
	    <td height="30" align="center" bgcolor="#316fb5"><h4 class="STYLE3">ID</h4></td>
	    <td align="center" bgcolor="#316fb5"><h4 class="STYLE3">比赛名称</h4></td>
	    <td align="center" bgcolor="#316fb5"><h4 class="STYLE3">状态</h4></td>
	  </tr>
  <?php
  for($i = 0; $i < $c_sum; $i ++)
  {
  ?>
	  <tr>
	    <td height="30" align="center" bgcolor="#dadada"><?php echo $contest_id[$i];?></td>
	    <td align="center" bgcolor="#dadada"><a href="contest.php?cid=<?php echo $contest_id[$i];?>"><strong><?php echo $contest_title[$i];?></strong></a></td>
	    <td align="center" bgcolor="#dadada"><span class="STYLE4">
		<?php
	    // past
		if (( $contest_1_active[$i] == 'N' || $contest_1_active[$i] == 'Y' && $now>$contest_1_end[$i]) && ($contest_0_active[$i] == 'N' ||  $contest_0_active[$i] == 'Y' && $now > $contest_0_end[$i])) 
			echo "<font color=green>已经结束@".(witchend($contest_0_end[$i], $contest_1_end[$i], $contest_0_active[$i], $contest_1_active[$i], $contest_0_end[$i], $contest_1_end[$i]))." </font>";
			
		// pending
		else if (( $contest_1_active[$i] == 'N' || $contest_1_active[$i] == 'Y' && $now< $contest_1_start[$i]) && ($contest_0_active[$i] == 'N' ||  $contest_0_active[$i] == 'Y' && $now < $contest_0_start[$i])) 
			echo "<font color=blue>即将开始@".(witchstart($contest_0_start[$i], $contest_1_start[$i], $contest_0_active[$i], $contest_1_active[$i], $contest_0_start[$i], $contest_1_start[$i]))."</font>";
			
		// Registering
		else 
			echo "<font color=red>注册进行中!</font>";
		?>
		</span></td>
	  </tr>

  <?php
  }
  ?>
</table>
</div>
<div style="height:150px;"></div>
  